package edu.towson.cis.cosc409.jmarr1.lab3;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

public class ToDoListActivity extends Activity {
	

	Button m_addButton;
	EditText m_editText;
	LinearLayout m_itemListView; 

	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_to_do_list);
        initLayout();
        onClick(m_addButton);
        
    }
	public void onClick(View v){
		String x = m_editText.getText().toString();
		ToDoItem y1 = new ToDoItem(x);
		TextView newItemTextView = new TextView(this);
		m_itemListView.addView(newItemTextView);
		m_editText.setText(null);
	}
	
	public void initLayout (){
		m_addButton = (Button) this.findViewById(R.id.button1);
		m_editText = (EditText) this.findViewById(R.id.editText1);
		m_itemListView = (LinearLayout) this.findViewById(R.id.toDoListView);
	}

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_to_do_list, menu);
        return true;
    }
}
